package com.cai.controller;

import com.cai.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello() {
        return "hello";
    }

    // 返回实体类会被扫描
    @PostMapping(value = "/user")
    public User user() {
        return new User();
    }

    // 给方法备注
    @ApiOperation("hello控制类")
    @GetMapping(value = "/hello2")
    // 参数备注
    public String hello2(@ApiParam("用户名") String username) {
        return "hello" + username;
    }
}